#ifndef IBOX_COMMAND_IFACE_H_INCLUDED
#define IBOX_COMMAND_IFACE_H_INCLUDED

#include <Core/SyncedCommandIOStream.h> 

#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>

namespace BoxCore {

/**
 * Abstract command interface(eg dispatcher)
 */
class IBoxCommandIFace {
public :
	typedef boost::function<void(int error, Core::SyncedCommandIOStreamPtr)> SpawnCompeletionFunc;

	IBoxCommandIFace() { }
	virtual ~IBoxCommandIFace() throw () { }
	
	virtual void initialize() throw (std::exception)= 0;	
	virtual void run() throw (std::exception) = 0;

	virtual bool spawn(Core::SyncedCommandIOStreamPtr stream, SpawnCompeletionFunc spawnCompeletion) throw () = 0;
	virtual void interrupt(bool graceful) throw() = 0;

};

typedef boost::shared_ptr<IBoxCommandIFace> IBoxCommandIFacePtr;

}

#endif

